<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
	String uid = (String)request.getParameter("uid");
	System.out.println(uid);
	request.setAttribute("uid",uid);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link type="text/css" rel="stylesheet" href="css/showpage1.css">
<link type="text/css" rel="stylesheet" href="css/showpage2.css">
<link type="text/css" rel="stylesheet" href="css/common.css">
<link type="text/css" rel="stylesheet" href="css/list.css">
<link type="text/css" rel="stylesheet" href="css/tan.css">
<link type="text/css" rel="stylesheet" href="css/banner.css">
<link type="text/css" rel="stylesheet" href="css/header.css">

<!--<link rel="stylesheet" href="css/a_tbcdn_cn.css">-->
<link rel="stylesheet" href="css/takeout.css">
<link type="text/css" rel="stylesheet" href="css/detail.css">
<script type="text/javascript" src="javascript/jquery-1.4a2.min.js"></script>
<script type="text/javascript" src="javascript/togobuilding.js"></script>
<script type="text/javascript" src="javascript/tip.js"></script>
<script type="text/javascript" src="javascript/jCommon.js"></script>
<script type="text/javascript" src="javascript/jquery.select.js"></script>
<script type="text/javascript" src="javascript/jquery.cycle.js"></script>
 
<script type="text/javascript">
$(document).ready(function(){
$('#banner').cycle({ fx:'scrollLeft',pager:'#btn'});
$(".shopitem").hover(function(){$(this).css({ background: '#fffbe8' });}, function(){$(this).css({ background: '#fff' });
if ('' != "17") {initnav(2);}else{initnav(4);}
})


var sortid = request("sortid");
if (sortid != "") {
$(".selectbox-wrapper li").removeClass("selected");
$("#ddlsort_input_" + sortid).addClass("selected");
$("#ddlsort_input").val($("#ddlsort_input_" + sortid).html());
}
var on = request("on");
if (on == "distance") {
$("#distancespan").attr("class", "up_icon_02_hover");
}
else {
$("#distancespan").attr("class", "up_icon_02");
}
var sid = request("sid");
if (sid != null && sid != "") {
getbuildlist(sid);
}
else {
$("#buildlist").hide();
}
});

$(document).ready(function(){
	
	var uid = "<%=uid%>";
	if("hcu" == uid){
		$("#uname").html("商大江北区");
	}
	
	
	var dataObj;
	
	$.ajax({ url: "<%=basePath%>initindex.do?m=initRest", data:{"uid" : uid }, dataType:"json", success: function(data){
        
       
        
        
 	var $ddnode = $("#searchList dl dd:eq(0)");
	$.each(data,function(idx,item){ 

	$ddnode.find("strong a").append(item.mobil);
	
	var hrefdian = "<%=basePath%>xiaodian.do?rid="+ item.rid;
	$ddnode.find(".shopname a").html(item.name).attr("href" , hrefdian);
	
	$ddnode.find(".address span").html(item.introduction);
	
	$ddnode.find(".tags span").html(item.mobil);
	

	$ddnode = $ddnode.next();
});        
        
        
      }});
      
	
	
	
	

}); 

	
function gosearch() {
    var key = $(".jtext");
    var mykey = key.val();
    
    if (mykey == "输入您想找的商家名称或地址等..." || key.val() == "") {
        var url = "";
        var num = $("#tbsearchtype").val();
        switch (num) {
            case "1":
                url = "/search.do?method=searchRestaurant&uid=<%=uid%>";
                break;
            case "2":
                url = "/search.do?method=searchDish&uid=<%=uid%>";
                break;
            case "3":
                url = "/bld.aspx";
                break;
        }
        var objpath = window.location + "";
        if (objpath.toLowerCase().indexOf("localhost") > 0) {
            url = "/web" + url;
        }
        window.location = url;
        return true;
    }
    else {
        var url = "";
        var num = $("#tbsearchtype").val();
        switch (num) {
            case "1":
                url = "search.do?method=searchDish&uid=<%=uid%>&keyword=" +  encodeURI(encodeURI(mykey));
                break;
            case "2":
                
                url = "search.do?method=searchRestaurant&uid=<%=uid%>&keyword=" + encodeURI(encodeURI(mykey));
                break;
            case "3":
                url = "/bld.aspx?keyword=" + escape(mykey);
                break;
        }
        var objpath = window.location + "";
        if (objpath.toLowerCase().indexOf("localhost") > 0) {
            url =  url;
        }
        window.location = url;
        return true;
    }
}



</script>

</head>
<body>
<div class="top">
<div class="wrap">
<div id="head_divNologin" class="top_left" style="display:;">您好，欢迎来订餐！ <a href="<%=basePath%>login.jsp" class="black">[登录]</a> <a href="<%=basePath%>register.jsp" class="orange"&nbsp;>[注册]</a></div>
<div id="head_divLoinged" class="top_left" style="display:none;"><strong id="head_spanuser" class="orange"></strong> 您好，欢迎来订餐！ <a href="/userhome/MyAddress.aspx" target="_blank">[会员中心]</a><a href="#" id="head_header_notice_num" target="_blank" class="notice_num" title="未查看通知">0</a><span><a href="/logout.aspx">
[退出]</a></span></div>
<div class="float_l margin_l10">
<span class="sina_icon" style="float: left;"><a href="http://weibo.com/hzfaneat " title="杭州饭易得的新浪微博" target="_blank">杭州饭易得</a></span>
<div style="float: left; margin-top:3px;">

</div>
</div>
<div class="top_right" style="position:relative;" >
<span class="my_order"><a href="myorder.aspx" id="head_orderurl" sub_id="htorder" class="dropdown_tool">我的订单</a></span> &nbsp;&nbsp;<span class="top_icon"><a href="javascript:void(0)" sub_id="hsection"
class="dropdown_tool">曾用地址</a></span> &nbsp;<span class="top_icon"><a href="javascript:void(0)"
sub_id="htogo" class="dropdown_tool">曾用店铺</a></span> &nbsp;<a href="/tlogin.aspx">商家登录</a> 
| <a href="/aboutus.aspx?sid=2">帮助中心</a></div>
</div>
</div>
<div class="header">
    <div class="wrap">
      
        <div class="fn-clear">
            <div class="logo">
                <a href="#" id="top_logolink" title="饭易得外卖网">
                    <img src="images/logo.jpg" id="top_logoimg" style="width: 178px; height: 75px;"></a>
            </div>
            <div style="margin-left:10px;padding-left:8px;float:left;margin-top:35px;background:url(http://img01.taobaocdn.com/tps/i1/T1G_BSXspdXXbReZ6r-1-2.png) repeat-y 0 0">
                
                <a href="http://life.taobao.com/market/life/city_page.php">
				<span id ="uname" style="display:block;font-size:20px;line-height:22px">商大江北校区</span>
                    </a>
                <a href="http://life.taobao.com/market/life/city_page.php">     
				 <span style="font-size:normal;font:tahoma,arial,\5b8b\4f53;color:#b3b3b3">[城市切换]</span>
                </a>
                    
            </div>
            <div class="search">
                <div class="bg">
                    <div class="search_class" id="head_searchtype_step1" onclick="show_searchtype_head()">
                        <a href="javascript:" id="a_current_lable">搜菜品</a>                    </div>
                    <div style="display: none;" class="search_class_hover" id="head_searchtype_step2">
                        <a class="search_class_a">搜小店</a>
                        <ul>
                            <li style="line-height: 24px;"><a href="javascript:set_searchtype(1,'搜菜品')">搜菜品</a></li>
                            <li style="border-bottom: 2px solid #e3e3e3; line-height: 24px;"><a href="javascript:set_searchtype(2,'搜小店')">
                                搜小店</a></li>
                        </ul>
                        <input id="tbsearchtype" value="1" type="hidden">
                    </div>
                    <input name="" class="search_text jtext" value="输入您想找的商家名称或地址等..." onfocus="if(value=='输入您想找的商家名称或地址等...') {value=''}" onblur="if (value=='') {value='输入您想找的商家名称或地址等...'}" type="text">
                    <input name="" class="search_btn" onclick="gosearch()" type="button"/>
                  </div>
            </div>
       </div>
    </div>
</div>
<div class="nav">
    <div class="wrap">
        <div class="nav_left">
            <ul>
                <li class="nav_hover" id="nav_li1"><a href="#">首 页</a></li>
                <li class="" id="nav_li2"><a href="#">精品外卖</a></li>
                <li id="nav_li7"><a href="#">平价外卖</a></li>
                <li id="nav_li3"><a href="#">团购外卖</a></li>
                <li id="nav_li4"><a href="#">蛋糕外送</a></li>
                <li id="nav_li5"><a href="#">积分商城</a></li>
                <li id="nav_li6"><a href="#">江湖点评</a></li>
            </ul>
        </div>
        <div class="hot_phone">
            <p>
                服务热线</p>
            <h4>
                0571-88225522</h4>
        </div>
    </div>
</div>

<script type="text/javascript">
    function show_searchtype_head() {
        $("#head_searchtype_step1").hide();
        $("#head_searchtype_step2").show();
    }

    //设置搜索类型
    function set_searchtype(type, mytext) {
        $("#head_searchtype_step1").show();
        $("#head_searchtype_step2").hide();
        $("#tbsearchtype").val(type);
        $("#a_current_lable").html(mytext);
        if (type == 1) {
            $("#tb_searchkey_2").hide();
            $("#tb_searchkey_1").show();
        }
        else {
            $("#tb_searchkey_1").hide();
            $("#tb_searchkey_2").show();
        }
    }         
</script>
